package com.example.hoasbackend.common;

public class IndentState {

    public static final String CREATED="CREATED";

    public static final String CANCELED="CANCELED";

    public static final String PAID="PAID";

    public static final String CHECKEDIN="CHECKEDIN";

    public static final String CHECKEDOUT="CHECKEDOUT";

    public static final String COMMENTED="COMMENTED";

    public static String nextState(String thisState,long indentOperationType){
        String nextState=thisState;
        if(thisState.equals(IndentState.CREATED)){
            if(indentOperationType==IndentOperationType.CANCEL){
                return IndentState.CANCELED;
            }
            else if(indentOperationType==IndentOperationType.PAY) {
                return IndentState.PAID;
            }
        }else if(thisState.equals(PAID)){
            if(indentOperationType==IndentOperationType.REDIS_TIMEOUT){
                return IndentState.CHECKEDIN;
            }
        }else if(thisState.equals(CHECKEDIN)){
            if(indentOperationType==IndentOperationType.REDIS_TIMEOUT){
                return IndentState.CHECKEDOUT;
            }
        }else if(thisState.equals(CHECKEDOUT)){
            if(indentOperationType==IndentOperationType.COMMENT){
                return IndentState.COMMENTED;
            }
        }
        return nextState;
    }
}
